package com.suray.type;

/**
 * 6代车阻挡原因
 */
public enum Rgv60BlockReason {
    INVALID(-1, ""),
    ULTRASONIC(0, "超声"),
    LASER(1, "激光"),
    FALLING_DOWN(2, "防跌落传感器"),
    COLLISION(3, "碰撞传感器"),
    INFRARED(4, "红外传感器"),
    LOCK(5, "锁车开关"),
    DYNAMIC_OBSTACLE(6, "动态障碍物"),
    VIRTUAL_LASER(7, "虚拟激光点"),
    CAMERA(8, "3D相机"),
    ;

    Integer value;
    String des;
    Rgv60BlockReason(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public int getValue() {
        return value;
    }

    public static Rgv60BlockReason parseReason(Integer value) {
        if (value == null) {
            return INVALID;
        }

        for (Rgv60BlockReason rgv60BlockReason : Rgv60BlockReason.values()) {
            if (rgv60BlockReason.value.equals(value)) {
                return rgv60BlockReason;
            }
        }

        return INVALID;
    }

    @Override
    public String toString() {
        return des;
    }
}
